package logic

import (
	"context"
	"goods-guru/goodrpc/goodrpc"
	"goods-guru/goodrpc/internal/svc"
	"goods-guru/model"

	"github.com/zeromicro/go-zero/core/logx"
)

type GoodListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewGoodListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodListLogic {
	return &GoodListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *GoodListLogic) GoodList(in *goodrpc.GoodListRequest) (*goodrpc.GoodListResponse, error) {
	// todo: add your logic here and delete this line
	var good model.Good
	model.DB.Debug().Find(&good)

	return &goodrpc.GoodListResponse{
		GoodID:    int64(good.ID),
		GoodName:  good.GoodName,
		GoodStyle: good.GoodStyle,
	}, nil
}
